/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.ensisa.pujaszymanski;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 *
 * @author Puja, Szymanski
 */
public class Topic {
    private static long ID = 0;
    
    private List<Message> messages;
    private String title;
    private long idTopic;

    public Topic(String title) {
	this.idTopic = Topic.ID;
	this.title = title;
	this.messages = new ArrayList<Message>();

	Topic.ID++;
    }

    public long getIdTopic() {
	return this.idTopic;
    }

    public void addMessage(Message m) {
	this.messages.add(m);
    }

    public List<Message> getMessages() {
	return this.messages;
    }

    public String getTitle() {
	return this.title;
    }

    public Iterator<Message> iterator() {
        return this.messages.iterator();
    }

    public boolean isEmpty() {
	return this.messages.isEmpty();
    }
}
